Method, computer, and computer program for detecting a bad block on a hard disk

ABSTRACT

In a method for detecting a bad block of a first computer&#39;s hard disk, the registry of the Microsoft Windows® operating system with which the first computer is configured is modified. Based on the modified registry of the Microsoft Windows® operating system, the hard disk is automatically scanned for bad blocks when the first computer&#39;s Microsoft Windows® operating system is booted. The result of the scan is stored in a file associated with the first computer. If at least one bad block is detected, then a message containing information about the bad block is generated at the first computer and conveyed over a communication network to a second computer.

BACKGROUND OF THE INVENTION

[0001] 1. Field of the Invention

[0002] The invention relates to automated detection of a bad block on ahard disk.

[0003] 2. Description of the Prior Art

[0004] The purpose of monitoring a network is to manage networkperformance, discover and solve network problems, and plan for networkgrowth. According to Morris Sloman (Editor), “Network and DistributedSystems Management”, Addison-Wesley, England, 1994, pg. 303, monitoringcan be defined as the process of dynamic collection, interpretation, andpresenting of information concerning objects or software processes underscrutiny. Monitoring can be used for general network management, such asperformance management, configuration management, fault management, orsecurity management. One application of monitoring is event reportingwhich is explained below using definitions taken from the aforementionedtext at pp. 303 to 347.

[0005] The network to be monitored is comprised of one or more managedobjects. A managed object is defined as any hardware or softwarecomponent whose behavior can be monitored or controlled by a managementsystem. Hardware components may be hubs, routers, computers, bridges,etc.. Each managed object is associated with a status and a set ofevents. The status of a managed object is a measure of its behavior at adiscrete point in time. An event is defined as an atomic entity whichreflects a change in the status of the managed object. The behavior ofthe managed object can be defined and observed in terms of its statusand events.

[0006] The status of the managed object lasts for a certain time period.Examples of a status are “process is idle” or “process is running”. Anevent occurs instantaneously. Examples of an event are “message sent” or“process started”. Since the status of an managed object is normallychanging continuously, the behavior of the managed object is usuallyobserved in terms of a distinguished subset of events, called events ofinterest. Events of interest reflect significant changes in the statusof the managed object.

[0007] In order to monitor the events of interest, events of interestmust be detected. An event is said to have occurred when the conditionswhich are defined by event detection criteria are satisfied. Theseconditions are detected by appropriate instrumentation, such as softwareand hardware probes or sensors inserted in the managed object.

[0008] Event detection may be internal within or external from themanaged object. Internally performed event detection is typicallyperformed as a function of the managed object itself. Externallyperformed event detection may be carried out by an external agent whichreceives status reports of the managed object and detects changes in thestatus of the managed object.

[0009] The occurrence of the event may be detected in real-time ordelayed. Once the event is detected, an event report is generated at themanaged object. The event report may comprise an event identifier, type,priority, time of occurrence, the status of the managed objectimmediately before and after the occurrence of the event, and otherapplication-specific status variables.

[0010] In order to monitor the dynamic behavior of the managed object,the event report may be conveyed from the managed object to a centralunit. At the central unit event reports may be gathered, visualized, andrecorded. The central unit may be a Network Management Station (NMS) onwhich an appropriate software, usually called a manager, resides. Themanager executes management applications that monitor and control themanaged objects. Physically, an NMS, sometimes called a console, isusually an engineering workstation with a fast CPU, megapixel colordisplay, substantial memory, and abundant disk space. The NMS maycomprise a database on which incoming reports sent by the managedobjects, such as event reports, are stored.

[0011] Received reports can be viewed with the Graphical User Interface(GUI) of the NMS.

[0012] One particular event of interest may be the occurrence of a badblock on a hard disk. If the hard disk has a bad block, then it is atleast partly defective. If the computer is configured with a MicrosoftWindows® operating system, such as Windows NT®, Windows 2000®, orWindows XP®, then a bad block on its hard disk cannot automatically bedetected, and a result of this is a limited monitoring of thatcomputer's hardware. According to the state of the art, it is possibleonly to manually check the hard disk by utilizing an appropriate tool ofthe Microsoft Windows® operating system. In addition, it is necessary toreboot the computer, if the check of the hard disk is to be completed.If the operating system is, for instance, Microsoft Windows NT®), thenthis tool is the “disk manager”. FIGS. 1 to 3 illustrate the manualsteps a person has to carry out when initiating the disk manager.

[0013] When initiating the disk manager, a window 10, as shown in FIG.1, is displayed on the screen connected to the computer. Since the harddisk will be checked for bad blocks, a field 11 labeled “Check Now . . .” of window 10 has to be activated, for example with a computer-mouseconnected to the computer. After that a window 20, as depicted in FIG.2, appears on the screen. Then the option “Automatically fix filesystemerrors” 21 has to be marked and the button 22 of window 20 has to beactivated. After activating button 22 which is labeled “Start”, a window30 which is shown in FIG. 3 appears on the screen. In order to continuethe check of the hard disk, button 31 of window 30 has to be activatedand the computer has to be restarted.

SUMMARY OF THE INVENTION

[0014] It is an objective of the present invention to provide a methodwhich enables automated detection and reporting of a hard disk's badblock if its related computer is configured with a Microsoft Windows®operating system. The Microsoft Windows® operating system shall not bebased on DOS, such as Microsoft Windows 95®.

[0015] Another objective of the present invention is to provide acomputer which is run by a Microsoft Windows® operating system and isconfigured to automatically detect and report a bad block of itsassociated hard disk.

[0016] A further objective of the present invention is to provide acomputer program which enables the relative easy configuration of acomputer which will automatically detect a bad block of the computer'shard disk. The computer is configured with a Microsoft Windows®operating system.

[0017] The above objective is achieved in accordance with the inventionby means of a method comprising the steps of: booting a first computerwhich is run by a Microsoft Windows® operating system; automaticallyinitiating a scan for bad blocks of a hard disk which is associated withthe first computer, based on a modified registry of the MicrosoftWindows® operating system of the first computer, reporting the result ofthe scan in a file associated with the first computer; generating, atthe first computer, a message containing information about a bad blockif a bad block is reported in the file related to the Microsoft Windows®operating system; and sending the message to a second computer over acommunication network.

[0018] According to the inventive method the first computer's registryof the Microsoft Windows® operating system is modified so that the scanof the hard disk is automatically initiated when the operating system isbooted. The operating system may be booted by turning on or restartingthe first computer. The scan is performed by an in-built function of theoperating system. The result of the scan may be reported in theMicrosoft Windows® operating system's system logfile or in a filedefined by a user of the first computer.

[0019] Should the scan find a bad block on that file, then the messagecontaining information about the bad block is generated at the firstcomputer and conveyed over the communication network to the secondcomputer. Consequently, the hard disk of the first computer is remotelymonitored by the second computer.

[0020] In a restricted version of the inventive method, the secondcomputer monitors the first computer with an agent-manager networkmanagement system, so that the message is an event report generated bythe agent-manager network management system. The agent-manager networkmanagement system is comprised of a manager, which is software residingat the second computer which may be a Network Management Station (NMS),and one or more agents. An agent is software residing at managed objectsmonitored by the NMS. The first computer is then configured with anagent and is also a managed object monitored by the NMS. The agent isconfigured to generate and send the event report to the manager. Networkmanagement systems are commercially available. Examples of networkmanagement systems are HP OpenView, IBM NetView, and Novel NetWare.

[0021] The inventive method can particularly be used for computers whichare configured with Windows 2000®, Windows XP®, or Windows NT® operatingsystems. The inventive method is, however, applicable to any MicrosoftWindows® operating system which are not based on DOS. This specificallyincludes any future releases of a Microsoft Windows® operating systemwhich is comparable to Microsoft Windows NT®, Windows 2000®, or WindowsXP®.

[0022] The objective is also achieved in accordance with the presentinvention with a first computer which is monitored by a second computerthrough a communication network. The first computer is configured with aMicrosoft Windows® operating system. The registry of the firstcomputer's Microsoft Windows® operating system is modified, so that afunction of the Microsoft Windows® operating system is automaticallyinitiated when booting the first computer's Microsoft Windows® operatingsystem. This function is designed to scan a hard disk associated withthe first computer for bad blocks. In addition, the first computer isconfigured to generate a message if at least one bad block of the harddisk is detected during the scan. Furthermore, the first computer isconfigured to convey the message which comprises information about atleast one bad block to the second computer over the communicationnetwork.

[0023] In a more restricted version of the invention, the first computermay be configured with an agent and the second computer may beconfigured with a manager, so that the message is an event reportgenerated by the agent. Then the second computer may be a NetworkManagement Station (NMS) which monitors the first computer, which may bethen a managed object. If the result of the scan is reported on thelogfile of the Microsoft Windows® operating system, then the agent ofthe first computer is configured to check the logfile and generate anevent report when the logfile has information about at least one badblock of the hard disk. The event report is then conveyed from the agentof the first computer over the communication network to the manager ofthe second computer. Consequently, if the invention is used incombination with an agent-manager Network Management System, thenremotely monitoring a hard disk of a computer which is configured with aMicrosoft Windows® operating system can be achieved in a relativelyconvenient way.

[0024] The Microsoft Windows® operating system may be Windows 2000®,Windows XP®, or Windows NT®. The invention is, however, not restrictedto Microsoft Windows 2000®, Windows XP®, or Windows NT® operatingsystems. The invention is generally applicable to Microsoft Windows®operating systems, including future releases and modifications, as longas they are not based on DOS.

[0025] The above objective is also achieved in accordance with theinvention by means of a computer program for configuring a computer runby a Microsoft Windows® operating system. The computer program isdesigned to modify the registry of the Microsoft Windows® operatingsystem with at least one entry, so that the operating systemautomatically initiates a scan of the computer's hard disk for badblocks when the Microsoft Windows® operating system is booted. Thecomputer program is further designed to record the result of the scan ina file associated with the computer.

DESCRIPTION OF THE DRAWINGS

[0026] FIGS. 1 to 3, as discussed above, illustrate how to manuallycheck a hard disk of a computer which is configured with a MicrosoftWindows® operating system.

[0027]FIG. 4 is a pictorial diagram of a computer being monitored byanother computer.

[0028]FIGS. 5 and 6 show entries in the registry of a computerconfigured with Windows NT®.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0029]FIG. 4 shows a computer 41 which is monitored by a NetworkManagement Station (NMS) 42 over a communication network 43. The NMS 42is physically a computer and monitors computer 42 using theagent-manager network management system HP OpenView for this exemplaryembodiment. On the NMS 42 resides a manager which communicates with anagent residing on computer 41. The manager is software configured toreceive reports sent by the agent. The agent is software configured tocontrol and detect significant changes in the status of computer 41according to a predefined set of event detection criteria. In thepresent exemplary embodiment, one event detection criterion is theoccurrence of at least one bad block of computer 41's hard disk 41 a.

[0030] Computer 41 is configured with a Microsoft Windows® operatingsystem. The operating system is Windows NT® for the exemplaryembodiment. Computer 41 can also be configured with any MicrosoftWindows® operating system as long as it is not based on DOS, likeWindows 95®. Thus, computer 41 also can specifically be configured withWindows 2000®, Windows XP®, or any future release of a MicrosoftWindows® operating systems which is comparable to Windows NT®, Windows2000®, or Windows XP®.

[0031] So that computer 42 can monitor computer 41, computer 41 isconfigured with a computer program which is added to the registry ofcomputer 41's Windows NT® operating system as depicted in FIG. 5. FIG. 5shows a list of executable computer programs with which computer 41'sWindows NT® operating system is configured. Among these computerprograms is a computer program which is named “MW_CreateAutoChkEntry”for the exemplary embodiment, which is designed to automaticallyinitiate the Windows' NT® scan function to automatically scan computer41's hard disk 41 a for bad blocks, when computer 41's operating systemWindows NT® is booted. After computer 41 is configured with computerprogram “MW_CreateAutoChkEntry”, the Session Manager of the Windows' NT®registry, as illustrated in FIG. 6, is modified by the entry“BootExecute”.

[0032] The scan function is part of the Windows NT® operating system andcan also be manually initiated. Furthermore, Windows NT® is booted, forinstance, when computer 41 is turned on. Thus, computer 41's hard disk41 a is checked for bad blocks whenever computer 41 is turned on.

[0033] The scan function is further designed to automatically report theresult of the scan in the system logfile of the Windows NT® operatingsystem. In order to remotely monitor computer 41, its agent isconfigured to check the system logfile and to generate an event reportif at least one bad block has been detected by the scan. The eventreport contains information about the discovered bad block and isconveyed to the manager of the NMS 42 over the communication network 43.The manager of the NMS 42 receives the event report, interprets themessage of the event report, and alerts an operator of the NMS 42 in away generally known in the art. The operator is not shown in theFigures.

[0034] An exemplary source code of the computer program“MW_CreateAutoChkEntry” which is written in PERL for the presentexemplary embodiment may have the following source code:################################################################################################################# # Run AutoChk inBlueScreen mode # (c) 2001 Siemens Medical Solutions ################################################################################################################## # Version 1.0 25.07.2001################################################################################################################# # globale variables$VersionNr = “1.0”; $applicationname = “$ENV{‘TEMP’}\\RunAutoChk.exe”;@time = localtime( );                      # determine date $host =Win32::NodeName;                          # determine computer name #************************************************************************************************# PROGRAM #************************************************************************************************use Win32::API; use Win32::Registry; use Win32::EventLog; # Work upprogram parameter CommandLineArgument(@ARGV); if ($LogPath eq “”){     # Used LOG-PATH   $LogFile = $ENV{‘TEMP’} . “\\RunAutoChk.Log”; }else {   $LogFile = $LogPath . “\\RunAutoChk.Log”; } #************************************************************************************************# Determine all local drives #************************************************************************************************%drives = GetDrives(3);      # determine DRIVE_FIXED @ localdrives =(keys %drives); @ localdrives = sort(@ localdrives); #************************************************************************************************# Execute SCANDISK during systemstart #************************************************************************************************RunAutoChk(\@localdrives, $LogFile);  if($main::HKEY_LOCAL_MACHINE- >Open(“Software\\Microsoft\\Windows\\CurrentVersion\\Run”,$nsm)){     $nsm->SetValueEx(“MW_CreateAutoChkEntry”, 0, REG_SZ,$applicationname . “/LogPath=\”“ . $LogPath . ”\“”);   } #************************************************************************************************# SUBROUTINES #************************************************************************************************sub RunAutoChk {########################################################### # ExecuteSCANDISK (AutoChk)########################################################### # IN: #@localdrive = All local drives # $logfilename = file where all will belogged ########################################################### #OUT: ###########################################################   my$refdrives   = shift;   my $logfilename   = shift;   my @localdrive =@$refdrives;   my ($drive, $commands, $allcommands) = (“”, “”, “”);   my$nsm = “”;   Protocol(“AutoChk”,“Info”, “Autocheck has been written tothe registry (drives: @localdrive).”, $logfilename);   print “Autocheckhas been written to the registry (drives: @localdrive).\n”;   foreach$drive ( @localdrive) {     $drive =˜ s/\\//g;     $commands =“autocheck autochk /r\\??\\” . $drive . “\x00”;     $allcommands .=$commands;   }   $allcommands .= “\x00”;  if($main::HKEY_LOCAL_MACHINE- >Open(“System\\CurrentControlSet\\Control\\SessionManager”, $nsm)){     $nsm->SetValueEx(“BootExecute”, 0, REG_MULTI_SZ,$allcommands);   } } sub GetDrives {########################################################### # List ofall local drives########################################################### # IN: # 1.$Typ = drive type, with value #  DRIVE_UNKNOWN = 0 #  DRIVE_NO_ROOT_DIR= 1 #  DRIVE_REMOVABLE = 2 #  DRIVE_FIXED = 3 #  DRIVE_REMOTE = 4#  DRIVE_CDROM = 5 #  DRIVE_RAMDISK = 6########################################################### # RETURN:# 1. Hash: Key     = drives #   Data   = drive description###########################################################   my $Typ =$_[0];   my $GetLogicalDrives ∥= new Win32::API(“kernel32”,“GetLogicalDrives”, [],N ) or return;   my %Drives;  #drive hash   my$xx;  #Decrementer   my $GetDriveType ∥= new Win32::API(“kernel32”,“GetDriveTypeA”, [P],N) or return;   my $GetVolumeInformation ∥= newWin32::API(“kernel32”, “GetVolumeInformationA”, [P, P, N, P, P, P, P,N],N) or return;   $AviableDrives = $GetLogicalDrives->Call( );    ##call available drives   for ($x=0; $x<=24; $x++) {     if (($AviableDrives & 2**$x) ) {       if ( $GetDriveType->Call(chr(65+$x) .“:\\”. “\0”) == $Typ) {         my $lpRootPathName = chr(65+$x) . “:\\”;        my $pVolumeNameBuffer = “\0”x255;         my $nVolumeNameSize =255;         my $lpVolumeSerialNumber = “ ”x255;         my$lpMaximumComponentLength = “ ”x255;         my $lpFileSystemFlags = “”x255;         my $lpFileSystemNameBuffer = “ ”x255;         my$nFileSystemNameSize = 255;          #call drive description         $successfully = $GetVolumeInformation->Call($lpRootPathName,$pVolumeNameBuffer, $nVolumeNameSize,         $lpVolumeSerialNumber,$lpMaximumComponentLength,          $lpFileSystemFlags,$lpFileSystemNameBuffer, $nFileSystemNameSize);         if($successfully == 1) {           # if success           $xx =length($pVolumeNameBuffer)−1;          while(ord(substr($pVolumeNameBuffer, $xx,1)) == 0 && ($xx > 0) ) {          # cut spaces           chop($pVolumeNameBuffer);           $xx= length($pVolumeNameBuffer)−1;         }         #save drivename inhash         $drives{chr(65+$x) . “:\\”} = $pVolumeNameBuffer;       }      else {        # if error        $drives{chr(65+$x) . “: \\”} = “Nodrives available”;       }      }    }   }   #return hash   return(%drives); } sub OpenEventLog {########################################################### # Opening ofNT-Event-Logs########################################################### # IN: # 1.$ComputerName =  computername # 2. $SourceName = (system, application orsecurity) ########################################################### #RETURN: ###########################################################   my$Computername = shift;   my $SourceName = shift;   %event=(    ‘Length’,NULL,     ‘RecordNumber’,NULL,     ‘TimeGenerated’,NULL,    ‘TimeWritten’,NULL,     ‘EventID’,NULL,     ‘EventType’,NULL,    ‘Category’,NULL,     ‘ClosingRecordNumber’,NULL,     ‘Source’,NULL,    ‘Computer’,NULL,     ‘Strings’,NULL,     ‘Data’,NULL,   );  Win32::EventLog::Open($EventLog, $SourceName, $Computername) ∥NSM::Common Error(“Can't open Eventlog\”);  $EventLog->GetNumber($count); } sub WriteEventLog {########################################################### # Write inNT-Event-Logs########################################################### # IN: # 1.$Computer   = computername # 2. $Source = source in EventLog # 3.$EventType   = Type in EventLog e.g. EVENTLOG_ERROR_TYPE orEVENTLOG_WARNING_TYPE # 4. $Category   = Category e.g.EVENTLOG_ERROR_TYPE or EVENTLOG_WARNING_TYPE # 5. $EventID   = EventIDin EventLog # 6. $Data   = Data # 7. $String   = String in der EventLog########################################################### # RETURN:###########################################################   my($Computer,$Source,$EventType,$Category,$EventID, $Data, $String) = @_;  %NewTestEvent=(     ‘Computer’, $Computer,     ‘Source’, $Source,    ‘EventType’, $EventType,     ‘Category’, $Category,     ‘EventID’,$EventID,     ‘Data’, $Data,     ‘Strings’, $String,   );  $EventLog->Report(\%NewTestEvent); } sub Protocol {########################################################### # Logging ina LOG-file with time stamp########################################################### # IN: # 1.Program name # 2. Errortype # 3. Errortext # 4. Filename     = e.g.SrvW_$DokuName.dat########################################################### #OUT:###########################################################   my$programname = shift;   my $errortype = shift;   my $errortext = shift;  my $filename = shift;   # unless (-d “$LogPath”) {   #    {grave over( )}md $LogPath{grave over ( )};   # }   if(open (OUTLOG, “>>$LogFile”)){     # Protocol -> LOG     my @time = localtime( ); determine date    printf OUTLOG (“%02u.%02u.%04u %02u:%02u:%02u;%12s;%-12s;%-7s;%-s\n” ,${time[3]}, ${time[4]} + 1, ${time[5]} + 1900,${time[2]}, ${time[1]},${time[0]}, $host, $programname, $errortype,$errortext);     close (OUTLOG);   } } sub CommandLineArgument { #*********************************************************** # Work upcommand line argument #***********************************************************   my($switch, $temp) = “”;   foreach $switch (@ARGV) {     if ($switch =˜/\/LogPath=/i) {       ($temp, $LogPath) = split (/=/, $switch);      chomp $LogPath;       $LogPath =˜ s/\\$//;     # delete last \ atlogpath input     }     if ($switch =˜ /\help/i ∥ $switch =˜/\/\?/i) {      HelpView( );       exit;     }     if ($switch =˜ /\/v/i) {      print “\nVersion $VersionsNr\n”;       exit;     }   } } subHelpView {   print “(c) 2001 Siemens Medical Solutions -ZX CS SD 1MW\n\n”;   print “Run the Autochk-Tool after a reboot in theblue-screen.\n\n”;   print “usage: RunAutoChk [/LogPath=Path toLog-File] [/?]\n\n”;   print “/LogPath=Path     Path to Log-File(Default = $ENV{‘TEMP’}).\n”;   print “/?    Display this help-page.\n”;  print “/Help     Display this help-page.\n\n”;   }

[0035] Subroutine “RunAutoChk” initiates the scan of hard disk 41 a whencomputer 41's Windows NT® operating system is booted. Subroutine“WriteEventLog” defines the result of the scan written in the eventlogfile of computer 41's Windows NT® operating system. The event logfileis a part of Windows' NT® system logfile.

[0036] For the exemplary embodiment, the computer program“MW_CreateAutoChkEntry” comprises further a subroutine “Protocol” whichis designed, if activated, to report the result of the scan in a furtherfile which is not associated with Windows' NT® logfile. If the result ofthe scan is written in that file and the contents of that file are usedto retrieve information about a bad block of hard disk 41 a, then theagent of computer 41 has to be configured to read this file.

[0037] Although modifications and changes may be suggested by thoseskilled in the art, it is the intention of the inventor to embody withinthe patent warranted hereon all changes and modifications as reasonablyand properly come within the scope of his contribution to the art.

I claim as my invention:
 1. A method, comprising the steps of: booting a first computer which is run by a Microsoft Windows® operating system; based on a modified registry of said Microsoft Windows® operating system of said first computer, automatically initiating a scan for bad blocks of a hard disk which is associated with said first computer; reporting the result of said scan in a file associated with said first computer; generating, at said first computer, a message containing information about said at least one bad block if said at least one bad block is reported in said file; and sending said message to a second computer over a communication network.
 2. The method of claim 1, said file being a system logfile of said Microsoft Windows® operating system.
 3. The method of claim 1, comprising monitoring said first computer with said second computer with an agent-manager network management system, so that said message is an event report generated by said agent-manager network management system.
 4. The method of claim 1, wherein said Microsoft Windows® operating system is Windows 2000®, Windows XP®, or Windows NT®.
 5. A first computer, which is monitored by a second computer over a communication network; said first computer being configured with a Microsoft Windows® operating system; the registry of said first computer's said Microsoft Windows® operating system being modified, so that a function of said Microsoft Windows® operating system is automatically initiated when booting said first computer's said Microsoft Windows® operating system; said function being designed to scan a hard disk associated with said first computer for bad blocks; said first computer being configured to generate a message if at least one bad block of said hard disk is detected during said scan and said message comprising information about said at least one bad block; and said first computer being configured to convey said message to said second computer over said communication network.
 6. The first computer of claim 5, wherein said first computer being configured with an agent and said second computer being configured with a manger, so that said message is an event report generated by said agent.
 7. The first computer of claim 6, wherein said Microsoft Windows® operating system is Windows 2000®, Windows XP®, or Windows NT®.
 8. A computer program for configuring a computer which is run by a Microsoft Windows® operating system; said computer program being designed to modify the registry of said Microsoft Windows® operating system, so that said Microsoft Windows® operating system automatically initiates a scan of said computer's hard disk for bad blocks when said Microsoft operating system is booted and to record the results of said scan in a file associated with said computer.
 9. The computer program of claim 8, said file being a system logfile of said Microsoft Windows® operating system.
 10. The computer program of claim 8, wherein said Microsoft Windows® operating system is Windows 2000®, Windows XP®, or Windows NT®. 